﻿$(function () {
    /*
    $("input:text[name='SalesCount']").blur(function () {
    var url = updateCarUrl;
    var productId = $(this).attr("id").split('_')[1];
    var count = $(this).val();
    var property = $("#property_" + $(this).attr("id").split('_')[1]).val();
    var description = $("#description_" + $(this).attr("id").split('_')[1]).val();
    var data = { productId: productId, count: $(this).val(), property: property, description: description };
    $.post(url, data, function (returndata) {
    window.location.href = window.location.href;
    }, "text");
    });*/
    $("input:radio[name=address]").each(function (i, dom) {
    if (i == 0) {
    $("#addressId").val($(dom).val());
    }
    });
    $("input:radio[name=address]").click(function () {
            $("#addressId").val($("input:radio[name=address]:checked").val());
    });
    $("#btnSubmit").click(function () {
        var selAddres = $("input:radio[name=address]:checked").val();
        if ($("input:radio[name=address]").length == 0) {
            alert("您还没有填写收货地址，请新增收货地址.");
            return;
        }
        if (selAddres == null) {
            alert("请选择收货地址.");
            return;
        }
        document.forms["previewOrderForm"].submit();
    });
});
function getAddress(addressRadio) {
    return $(addressRadio).attr("checked");
}